<?php	
class Obj_SameObjects {
	
	protected static $t;
	
	public static function init() {
		self::$t = new Obj_DBTable_SameObjects();
	}
	
	public static function saveSameObject($arData, $id) {
		if ((int)$id == (int)0) {
			return self::$t->insert($arData);
		}
		else self::$t->update($arData, 'ObjectID = '.intval($id));
		return intval($id);
	}

	public static function getAllSameObjects() {
		$ar_ = self::$t->getAllSameObjects();
		$ar = array();
		foreach ($ar_ as $k => $v) {
			$ar[$v['ID']] = $v;
		}
		return $ar;
	}

	public static function getSameObjectsByObject($ObjectID) {
		return self::$t->getSameObjectsByObject($ObjectID);
	}
		
	public static function delSameObject($ObjectID){
		return self::$t->delete('ObjectID = '.intval($ObjectID));
	}
	
}Obj_SameObjects::init();

